<?php
/**
 * Created by PhpStorm.
 * User: CS
 * Date: 2018/11/27
 * Time: 19:48
 */
namespace app\common\error;

use Exception;
use think\db\exception\ModelNotFoundException;
use think\exception\Handle;

class Error extends Handle
{
    public function render(Exception $e)
    {
        if($e instanceof ModelNotFoundException){
            return json(['state'=>5002,'msg'=>'没有找到数据哦','data'=>[]]);
        }
        return json(['state'=>5001,'msg'=>'服务器出错了，你看着办吧!','data'=>[]]);
        //return parent::render($e); // TODO: Change the autogenerated stub
    }
}